package response;

import core.Constants;
import core.GamePacket;
import core.GameQuestion;

/**
 * @author Gary
 */
public class ResponseBoardQuestion extends GameResponse {

    private GameQuestion question;
    private int duration;

    public ResponseBoardQuestion() {
        code = Constants.SMSG_BOARD_QUESTION;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public void setQuestion(GameQuestion question) {
        this.question = question;
    }
    
    public GameQuestion getQuestion() {
        return this.question;
    }

    @Override
    public byte[] createResponse() {
        GamePacket packet = new GamePacket(code);
        packet.addUint32(duration);
        packet.addUint16(question.getID());
        packet.addUint16(question.getType());
        packet.addString(question.getTopic());
        packet.addString(question.getText());
        packet.addString(question.getPreparedOptions());
        packet.addString(question.getPreparedOptionsStatus());

        return packet.getBytes();
    }
}
